#e
#Title[^u̒̊^ Ceւ̓-Lunatic-v]
#Text[G@LukzKqv]
#ScriptVersion[2]
#PlayLevel[Lunatic]
#Player[FREE]

script_enemy_main {
 let img = "script\img\ExRumia.png";
 let name = "^u̒̊^ Ceւ̓-Lunatic-v";

 @Initialize {
  CutIn(KOUMA, name, "", 0, 0, 0, 0);
  SetX(GetCenterX);
  SetY(GetCenterY - 120);
  SetLife(7000);
  SetScore(1000000);

  LoadGraphic(img);
  SetTexture(img);
  SetGraphicRect(64, 0, 128, 64);

  TMain;
 }

 @MainLoop {
  SetCollisionA(GetX, GetY, 24);
  SetCollisionB(GetX, GetY, 24);

  yield;
 }

 @DrawLoop {
  DrawGraphic(GetX, GetY);
 }

 @Finalize {
  DeleteGraphic(img);
 }

 task TMain {
  yield;

  TShot;
  TRadius;
  TRight;
 }

 task TShot {
  let x = 0;
  yield;

  loop {
   loop(13) { yield; }
   SetShotColor(255, 255, 255);
   CreateShot01(x, GetClipMinY, 2, atan2(GetPlayerY - GetClipMinY, GetPlayerX - x), WHITE11, 0);
   x = rand(GetClipMinX, GetClipMaxX);
  }
 }

 task TRadius {
  let x = 0;
  let y = 0;
  yield;

  loop {
   loop(1) { yield; }
   SetShotColor(1, 1, 1);
   CreateShot01(GetPlayerX + offsetX(80, x), GetPlayerY + offsetY(80, y), 0.1, atan2(GetPlayerY - (GetPlayerY + offsetY(80, y)), GetPlayerX - (GetPlayerX + offsetX(80, x))) - 180, WHITE11, 0);
   x += 5;
   y += 5;
  }
 }

 task TRight {
  yield;

  loop {
   loop(30) { yield; }
   SetShotColor(244, 244, 244);
   CreateShot01(GetX - 100, GetY, 1, atan2(GetPlayerY - GetY, GetPlayerX - (GetX - 100)), BLUE11, 0);
   CreateShot01(GetX + 100, GetY, 1, atan2(GetPlayerY - GetY, GetPlayerX - (GetX + 100)), RED11, 0);
  }
 }

 function offsetX(radius, mid) {
  return radius * cos(mid);
 }

 function offsetY(radius, mid) {
  return radius * sin(mid);
 }

}